<%@ page import="ch01.SecondLevelTitle"%>
<%@ page import="ch03.SecondLevelTitleDbOpreation"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="ch01.User"%>
<%
	User loginUser = (User) session.getAttribute("LOGIN USER");
	if (loginUser == null) {
		response.sendRedirect("login.html");
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	<%
	request.setCharacterEncoding("UTF-8");


	String titleName = request.getParameter("twotile");
	int parentTitleID = Integer.parseInt(request.getParameter("parent").toString());
	String filePath = request.getParameter("filepath");
	String creater = "管理员";

	SecondLevelTitle sTitle = new SecondLevelTitle();
	sTitle.setTitleName(titleName);
	sTitle.setParentTitleId(parentTitleID);
	sTitle.setFilePath(filePath);
	sTitle.setCreator(creater);

	//将对象插入数据库
	int result = SecondLevelTitleDbOpreation.insertOneRecord(sTitle);
	if (result > 0) {
		request.getRequestDispatcher("title_file_sucess.jsp").forward(
				request, response);
	} else {

		request.getRequestDispatcher("error.jsp").forward(request,
				response);
	}
%>
	
</body>
</html>